﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>1.</title>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shCore.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushJScript.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushCSharp.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushXml.js"></script>
    <link type="text/css" rel="stylesheet" href="../../Content/highlighter/styles/shCore.css"/>
    <link type="text/css" rel="stylesheet" href="../../Content/highlighter/styles/shCoreEclipse.css" />
    <script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body>
    <h3>默认Url规则</h3>
    <b>1.插件配置URL：</b><br/>
        下面是plug.json配置中的Url配置节:
    <p>
        其中url.prefix指Url前缀<br />
        url.extension指Url后缀<br />
        defaultDocument指Url如果以"/"结尾则处理时自动加上/index.php<br />
        例如:"/shop/" => "/shop/index.php"<br />
    </p>
    <pre class="brush:xml;">
        //Url设置，用于处理控制器行为中的Url表达式。
        "url": {
        //url前缀
        "prefix": "App",
        //url后缀
        "extension": ".php",
        //默认文档
        "defaultDocument": "index.php"
        },
    </pre>
    <p>
        Url=Url前缀(plug.json中的url.prefix)<br />
        +"/"+[Area特性中的区域名称]<br />
        +"/"+[Controller特性中的控制器名称|类名去掉Controller]<br />
        +"/"+[Action特性中的动作名称|方法名]<br />
        +".html"(plug.json中的url.extension项)<br />
    </p>
    <b>2.不使用任何特性，也不修改plug.json</b><br />
    URL="/"+类名去掉Controller+"/"+方法名<br />
    +".html"(plug.json中的url.extension项,默认为.html)
    <pre class="brush: csharp;">
		//默认规则
		public class IndexController: BaseController
		{
            //Url:"/Index/Index.html"
			public void Index()
			{
				this.Write("Hello World!");
			}
		}
    </pre>
    <b>3.使用特性，也不修改plug.json</b><br />
    URL="/"+[Area特性中的区域名称]<br />
    +"/"+[Controller特性中的控制器名称|类名去掉Controller]<br />
    +"/"+[Action特性中的动作名称|方法名]<br />
    +".html"(plug.json中的url.extension项)
    <pre class="brush:csharp;">
        using NFinal;
        [Area("sample")]
        [Controller("index")]
        public class IndexController : BaseController
        {
            //Url:"/sample/index/index.html"
            [Action("index")]
            public void Index()
            {
                this.Write("Hello World!");
            }
        }
    </pre>
   
    <b>4.不使用特性，url前缀改为"/App",后缀改为".jsp"</b>
    <pre class="brush:csharp;">
        using NFinal;
        
        public class IndexController : BaseController
        {
            //Url:"/App/Index/Index.jsp"
            public void Index()
            {
                this.Write("Hello World!");
            }
        }
    </pre>
    <b>5.使用简单特性,Url前缀改为"/App"，后缀改为".php"</b>
    <pre class="brush:csharp;">
        using NFinal;

        [Area("sample")]
        [Controller("index")]
        public class IndexController : BaseController
        {
            //Url:"/App/sample/index/index.php"
            [Action("index")]
            public void Index()
            {
                this.Write("Hello World!");
            }
        }
    </pre>
</body>
</html>